<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>新建分组</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/module_form.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_memberAdd.css">
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<!--数据列表插件开始-->
<link href="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<link href="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Css/etgrid.css" rel="stylesheet" type="text/css">
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.ui.position.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Plugins/ContextMenu/src/jquery.contextMenu.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Plugins/Etgrid/Js/etgrid.js"></script>
<!--数据列表插件结束-->
</head>
<body>
<div class="page_header">
	<div class="table_tool">
		<ul class="clearfix">
			<li class="openwin btn" etitle="新建分组" eheight="150px" ewidth="400px" ehref="{:U('Group/add')}" id="groupAdd"><i class="icon-plus"></i> 新建分组</li>
			<li class="line"></li>
			<li class="memberChart btn"><i class="icon-bar-chart"></i> 统计报表</li>
		</ul>
	</div>
</div>
	<div class="table_box">
	</div>
	<div class="page_footer pdtd10">
		<input type="button" name="submit" value="确认添加"  class="form_ele_submit"/>
		<input type="reset" name="reset" value="取消操作"  class="form_ele_reset"/>
	</div>
</body>
<script type="text/javascript">
	var listConfig = {
			blockBox : '.table_box',
			blockBoxHeight : 'window',
			jsonUrl : '__URL__/addMember',
			where : '',
			widthType : 'tdw', //thw-标题标准宽度、tdw-数据单元标准宽度、auto-随数据单元宽度
 			pageNum : 10,
			nowPage : 1, 
 			orderName : "addtime",
			orderDirection : "desc", 
			dataContextMenuOpen: true, //是否开启数据行右键菜单
			dataContextMenu: function(){
				$.contextMenu({
					selector: '.et_tbody tr',
					items: {
						"detail": {
							name: "查看", 
							icon: "remove",
							callback: function(key, options) {
								var href = "{:U('Custom/detail')}&id="+$(this).attr('rowid');
								var width = '900px';
								var height = '500px';
								var title = '会员详情';
								openDialog('customDetail',href,width,height,title);
							}
						},
						"edit": {
							name: "修改", 
							icon: "edit",
							callback: function(key, options) {
								var href = "{:U('Custom/edit')}&id="+$(this).attr('rowid');
								var width = '900px';
								var height = '500px';
								var title = '修改会员';
								openDialog('customEdit',href,width,height,title);
							}
						},
						"delete": {
							name: "删除", 
							icon: "remove",
							callback: function(key, options) {
								//var title =  $(this).children('td[fieldname="title"]').html();
								
								var id = $(this).attr('rowid');
								$.post("{:U('Custom/del')}",{id:id},function(data){
									$('.et_tfoot .page_refresh').click(); //刷新加载
								})
							}
						}
					}
				});
			},
			colModel : [
				{
					display : 'checkbox',
					name : 'id',
					sortable : false,
					myclass : 'center',
					edit : false
				},
				{
					display : '姓名',
					name : 'realname',
					sortable : true,
					myclass : 'center',
					edit : false
				},
				{
					display : '手机号码',
					name : 'mobile',
					sortable : true,
					myclass : 'center',
					edit : false
				},
				{
					display : '电邮',
					name : 'email',
					sortable : true,
					myclass : 'center',
					edit : false
				},
				{
					display : '性别',
					name : 'sex',
					sortable : true,
					myclass : 'center',
					edit : false
				}
			]
		};
	
	//实例化列表
	var tableList = $('.table_box').EtGrid(listConfig);
	//tableList.erefresh()；
	
	$("form_ele_reset").on("click",function(){
		frameApi.close(); //关闭当前窗口
	});
	
	$(".form_ele_submit").on("click",function(){
		var id      = tableList.getChecked();
		var groupid = '{$Think.get.id}';
		$.get("{:U('Group/addMem')}",{id:id,groupid:groupid},function(data){

			windowApi.lhgdialog.tips('添加成功！',1,etIcon.success,function(){
				
				var obj  = windowApi.lhgdialog.list['groupEdit'];
				obj.reload(obj);
				$('.et_tfoot .page_refresh').click(); //刷新加载
			});
		});
	});
</script>
</html>
